package com.itlong.cloud.user.sdk;

import com.itlong.cloud.POJO.DTO.sdk.VisitorServerGetListDTO;
import com.itlong.cloud.POJO.DTO.sdk.VisitorServerSubmitDTO;
import com.itlong.cloud.POJO.VO.sdk.VisitorServerGetListVO;
import com.itlong.cloud.utils.page.Page;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

/**
 * <desc>
 *      访客API暴露接口。
 * <desc/>
 *
 * @createDate 2019/04/29
 */
@FeignClient(name = "user-service")
public interface IVisitorServerServiceClient {

    /**
     * <desc>
     *      验证身份信息
     * <desc/>
     *
     * @param projectId
     * @return
     * @author Jiaqi.X
     * @createDate 2019/04/29
     */
    @PostMapping(path = "/server/visitor/checkIdentity")
    Integer checkIdentity(@RequestParam("projectId") String projectId,
                          @RequestParam("appid") String appid,
                          @RequestParam("appSecret") String appSecret);

    /**
     * <desc>
     *      获取地址信息
     * </desc>
     *
     * @param projectId
     * @param buildId
     * @param unitId
     * @return
     * @author Jiaqi.X
     * @createDate 2019/04/29
     */
    @PostMapping(path = "/server/visitor/getAddressInfo")
    List<Map<String,Object>> getAddressInfo(@RequestParam("projectId") String projectId,
                                            @RequestParam(value = "buildId",required = false) String buildId,
                                            @RequestParam(value = "unitId",required = false) String unitId);

    /**
     * <desc>
     *      提交访客单
     * </desc>
     *
     * @param dto
     * @return
     * @author Jiaqi.X
     * @createDate 2019/04/29
     */
    @PostMapping(path = "/server/visitor/submit")
    Map<String,Object> submit(@RequestBody VisitorServerSubmitDTO dto) throws Exception;

    /**
     * <desc>
     *      查询访客单列表
     * </desc>
     *
     * @param dto
     * @return
     * @author Jiaqi.X
     * @createDate 2019/04/29
     */
    @PostMapping(path = "/server/visitor/getList")
    Page<VisitorServerGetListVO> getList(@RequestBody VisitorServerGetListDTO dto) throws Exception;

    /**
     * <desc>
     *      审批
     * </desc>
     *
     * @param projectId
     * @param visitorNo
     * @return
     * @author Jiaqi.X
     * @createDate 2019/04/29
     */
    @PostMapping(path = "/server/visitor/approve")
    String approve(@RequestParam("projectId") String projectId,@RequestParam("visitorNo") String visitorNo) throws Exception;
}
